#!/usr/bin/env python
# coding: utf-8

# In[10]:


import pandas as pd

def low_score_red(s):
    color = "red" if s < 60 else "black"
    return f"color:{color}"
#学习上面这种格式化的表达方式

def highlight_color(col):
    return ["background-color:lime" if s == col.max() else "background-color:white" for s in col]


students = pd.read_excel(r"/Users/andy/Downloads/025/Students.xlsx")
students.style.applymap(low_score_red, subset=["Test_1","Test_2","Test_3"]).apply(highlight_color, subset=["Test_1","Test_2","Test_3"])
#这里对于单元格, 要使用applymap, 对于dataframe则使用apply. 注意这里要使用subset指定对应的列


# In[ ]:




